home *** CD-ROM | disk | FTP | other *** search
- #include <X11/Intrinsic.h>
- #include <stdlib.h>
-
- #include "MyCanvas.h"
- #include "monitor.h"
-
- #define AWT_LOCK() awt_lock_enter()
- #define AWT_UNLOCK() awt_lock_exit()
-
-
- struct ComponentData {
- Widget widget;
- int repaintPending;
- int x1, y1, x2, y2;
- };
-
- struct CanvasData {
- struct ComponentData comp;
- Widget shell;
- int flags;
- };
-
- JNIEXPORT void JNICALL Java_MyCanvas_X11DrawLine
- (JNIEnv *env, jobject this, jint pData, jint x0, jint y0, jint x1, jint y1)
- {
-
- struct CanvasData *wdata;
- Window w;
- Display *d;
- GC gc;
-
- wdata = (struct CanvasData*)pData;
- AWT_LOCK();
- w = XtWindow(wdata->comp.widget);
- d = XtDisplay(wdata->comp.widget);
- gc = XCreateGC(d,w,0,0L);
- XSetForeground(d, gc, WhitePixel(d,0));
- XSetBackground(d, gc, BlackPixel(d,0));
-
- XDrawLine(d, w, gc, x0, y0, x1, y1);
- AWT_UNLOCK();
-
- }
-